<div class="post">
  <div class="post_title"><%= image_tag "#{post.from || 'original'}.png" %><%= link_to post.title, post %></div>
  <div class="post_time">By <span class="username"><%= post.user_username %></span> <%= post.created_at.to_s(:db) %></div>
  <div class="post_content">
    <% if is_show? %>
      <%= post.content %>
      <div class="tags_read_more"><%= format_tags(post.tags) %></div>
    <% else %>
      <%= truncate(post.content.clear_html,:omission => "......<div class=\"tags_read_more\">#{format_tags(post.tags)}<span class=\"read_more\">#{link_to '阅读全文', post}</span></div>",:length => 300) %>
    <% end %>
  </div>
  <div class="post_category">
    Posted in <%= link_to post.category_name, post.category %> |
    <%= link_to "#{post.comments_count} 评论", post_path(post, :anchor => "comments") %> |
    <%= post.view_count %> 浏览
    <% if is_admin? %>
      | <%= link_to_remote image_tag('edit.png',:title => '编辑'), :update => 'content', :method => :get, :url => edit_post_path(post) %>
      <%= link_to image_tag('delete.png',:title => '删除'), post, :confirm => 'Are you sure?', :method => :delete %>
    <% end %>
  </div>
</div>
<% if is_show? %>
  <b><%= post.comments_count.to_i > 0 ? '日志评论:' : '暂无评论' %></b>
  <!-- 评论 -->
  <div id="comments">
    <a name="comments"></a>
    <%= render :partial => "comments/comment", :collection => post.comments %>
  </div>
  <!-- 评论表单 -->
  <div id="comment_form">
    <%= render :partial => "comments/new", :post => post %>
  </div>
<% end %>
